package com.cswnode.demo;

import cn.hutool.extra.mail.MailUtil;
import com.cswnode.demo.util.Utils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author csw
 * @create 2021/2/28 13:38
 */

public class testTemplateMail {

    @Autowired
    private MailUtil mailUtil;

    private final String receiver = "1209320662@qq.com";

    @Test
    public void testTemplateMail() {
        MailUtil mailUtil = new MailUtil();
        //发送邮件
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
        String subject = "SecondGoodTrade用户注册";
        String emailTemplate = "activeMail";
        String code = Utils.GetUUID().substring(5);
        Map<String, Object> dataMap = new HashMap<>();
        dataMap.put("username", "陈绍威");
        dataMap.put("email", receiver);
        dataMap.put("code", code);
        dataMap.put("createTime", sdf.format(new Date()));
        dataMap.put("url","127.0.0.1:8080/");

    }
}
